package net.sareweb.acab.entity;

// Generated 13-abr-2010 15:53:20 by Hibernate Tools 3.2.5.Beta

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * State generated by hbm2java
 */
@Entity
@Table(name = "state", catalog = "acab")
public class State implements java.io.Serializable {

	private Integer idState;
	private Country country;
	private String name;
	private String code;
	private Set<Request> requestsForFromState = new HashSet<Request>(0);
	private Set<Travel> travelsForToState = new HashSet<Travel>(0);
	private Set<City> cities = new HashSet<City>(0);
	private Set<Request> requestsForToState = new HashSet<Request>(0);
	private Set<Travel> travelsForFromState = new HashSet<Travel>(0);

	public State() {
	}

	public State(Country country, String name) {
		this.country = country;
		this.name = name;
	}

	public State(Country country, String name, String code,
			Set<Request> requestsForFromState, Set<Travel> travelsForToState,
			Set<City> cities, Set<Request> requestsForToState,
			Set<Travel> travelsForFromState) {
		this.country = country;
		this.name = name;
		this.code = code;
		this.requestsForFromState = requestsForFromState;
		this.travelsForToState = travelsForToState;
		this.cities = cities;
		this.requestsForToState = requestsForToState;
		this.travelsForFromState = travelsForFromState;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idState", unique = true, nullable = false)
	public Integer getIdState() {
		return this.idState;
	}

	public void setIdState(Integer idState) {
		this.idState = idState;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "country", nullable = false)
	@NotNull
	public Country getCountry() {
		return this.country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	@Column(name = "name", nullable = false, length = 200)
	@NotNull
	@Length(max = 200)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "code", length = 45)
	@Length(max = 45)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "stateByFromState")
	public Set<Request> getRequestsForFromState() {
		return this.requestsForFromState;
	}

	public void setRequestsForFromState(Set<Request> requestsForFromState) {
		this.requestsForFromState = requestsForFromState;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "stateByToState")
	public Set<Travel> getTravelsForToState() {
		return this.travelsForToState;
	}

	public void setTravelsForToState(Set<Travel> travelsForToState) {
		this.travelsForToState = travelsForToState;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "state")
	public Set<City> getCities() {
		return this.cities;
	}

	public void setCities(Set<City> cities) {
		this.cities = cities;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "stateByToState")
	public Set<Request> getRequestsForToState() {
		return this.requestsForToState;
	}

	public void setRequestsForToState(Set<Request> requestsForToState) {
		this.requestsForToState = requestsForToState;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "stateByFromState")
	public Set<Travel> getTravelsForFromState() {
		return this.travelsForFromState;
	}

	public void setTravelsForFromState(Set<Travel> travelsForFromState) {
		this.travelsForFromState = travelsForFromState;
	}

}
